package file;

import java.io.File;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2022/4/7
 * \* Time: 17:37
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class Demo2 {
    public static void main(String[] args) {
        //绝对路径
        File f = new File("d:a.txt");
        System.out.println(f.exists());//判定是否存在
        System.out.println(f.isDirectory());//判定是否是目录
        System.out.println(f.isFile());//判定是否是文件

        System.out.println("---------------------");
        //相对路径
        File f2 = new File(".a.txt");
        System.out.println(f2.exists());//判定是否存在
        System.out.println(f2.isDirectory());//判定是否是目录
        System.out.println(f2.isFile());//判定是否是文件
    }
}
